package bomber.init;

import bomber.model.GameManager;
import bomber.model.ProperReader;


public class AppInit {

	private int gameSize;
	private int gameBomb;
	private int gameRock;
	private int gameHelp;

	public AppInit() {
		this.loadSetup();		
	}

	private boolean loadSetup() {
		try {
			ProperReader pr = new ProperReader("config");
			this.gameSize = Integer.parseInt(pr.getProperty("game.size"));
			this.gameBomb = Integer.parseInt(pr.getProperty("game.bomb"));
			this.gameRock = Integer.parseInt(pr.getProperty("game.rock"));
			this.gameHelp = Integer.parseInt(pr.getProperty("game.help"));
			return true;
		}
		catch (Exception ex) {
			this.gameSize = 10;
			this.gameBomb = 10;
			this.gameRock = 0;
			this.gameHelp = 0;
			return false;
		}
	}

	public GameManager newGame() {
		return new GameManager(gameSize, gameBomb, gameRock, gameHelp);
	}
}
